<template lang="pug">
  el-table-column(prop="prop" v-bind:label="label" v-bind:format="format" align="center"  width="180")
    template(slot-scope="scope")
      i(v-if="scope.row[prop]" class="el-icon-time")
      template(v-if="format === null || format === ''")
        span {{scope.row[prop]}}
      template(v-else)
        span {{fmtDate(scope.row[prop], format)}}
</template>

<script type="text/ecmascript-6">
  import {formatDate} from '../../common/typeFormat'

  export default {
    name: 'kalix-date-column',
    props: {
      prop: '',
      label: '',
      format: {
        type: String,
        default: ''
      }
    },
    methods: {
      fmtDate(date, fmt) {
        return formatDate(date, fmt)
      }
    }
  }
</script>

<style scoped lang="stylus">

</style>
